/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.raflik.queryxml.serializer.standard;

import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JList;
import org.openide.util.NbBundle;
import pl.raflik.queryxml.ui.SelectableComboBoxRenderer;

/**
 *
 * @author raflik
 */
public class BooleanCellRenderer extends SelectableComboBoxRenderer {

    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

        if (value instanceof String) {
            String string = (String) value;
            if (string.equals(Boolean.TRUE.toString()) || string.equals(Boolean.FALSE.toString())) {
                label.setText(NbBundle.getMessage(BooleanCellRenderer.class, "BooleanCellRenderer." + string));
            }
        }
        return label;
    }
}
